﻿/******************************************************************************
 * Copyright (C) 2015  671643387@qq.com
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 *
 *****************************************************************************/

#ifndef UCOP_SYSTEM_ERROR_H_
#define UCOP_SYSTEM_ERROR_H_

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif

#include <cstddef>
#include <string>


namespace Ucop {
namespace System {

    /* Get last error code */
    int GetLastError(void);
    /* Get last network error code */
    int GetLastNetError(void);

    /* Get error description */
    const char* GetErrorString(char* _Dest, std::size_t _Size, int _Code);
    const char* GetErrorString(std::string &_Dest, int _Code);
    const std::string GetErrorString(int _Code);

    /* Print error message */
    void PrintError(const char* _Message, int _Code = GetLastError());

}}

#endif // UCOP_SYSTEM_ERROR_H_
